home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / bbsutil / hsrc_117.zip / LASTREAD.C < prev    next >
Text File  |  1990-08-21  |  784b  |  33 lines

  1. #include "msgg.h"
  2. #include "twindow.h"
  3. #include "headedit.h"
  4.  
  5.  
  6. void pascal load_lastread (void) {
  7.  
  8.     int fp;
  9.  
  10.     if(!totalareas) return;
  11.     sprintf(buffer,"%sLASTREAD.BBS",path);
  12.     if ((fp=_open(buffer,O_RDONLY | O_BINARY | O_DENYNONE))==-1) return;
  13.     lseek(fp,(long)(userno-1)*(long)((long)totalareas*(long)sizeof(word)),SEEK_SET);
  14.     _read(fp,lastread,totalareas*sizeof(word));
  15.     _close(fp);
  16. }
  17.  
  18.  
  19.  
  20. void pascal save_lastread (void) {
  21.  
  22.     int fp;
  23.  
  24.     if(!totalareas) return;
  25.     sprintf(buffer,"%sLASTREAD.BBS",path);
  26.     if ((fp=_open(buffer,O_RDWR | O_BINARY | O_DENYNONE))==-1)
  27.         if ((fp=creat(buffer,S_IWRITE))==-1) return;
  28.     lseek(fp,(long)(userno-1)*(long)((long)totalareas*(long)sizeof(word)),SEEK_SET);
  29.     _write(fp,lastread,totalareas*sizeof(word));
  30.     _close(fp);
  31. }
  32.  
  33.